<?php


namespace App\Controller\Cooperative;


use App\Controller\AbstractController;
use App\Request\Cooperative\NoticeListRequest;
use App\Request\Cooperative\NoticeRequest;
use App\Service\Cooperative\NoticeCooperService;
use Hyperf\Di\Annotation\Inject;
use Psr\Http\Message\ResponseInterface;

class NoticeController extends AbstractController
{
    /**
     * @Inject()
     * @var NoticeCooperService
     */
    protected $noticeCooperService;

    /**
     * 获取未读消息数
     * @param NoticeListRequest $request
     * @return mixed|ResponseInterface
     */
    public function UnreadList(NoticeListRequest $request)
    {
        $param = $request->all();
        $data = $this->noticeCooperService->UnreadList($param);
        return $this->response->success($data);
    }

    /**
     * 设置消息已读
     * @param NoticeRequest $request
     * @return mixed|ResponseInterface
     */
    public function SetRead(NoticeRequest $request)
    {
        $param = $request->validated();
        $data = $this->noticeCooperService->SetRead($param['ids']);
        return $this->response->success($data);
    }

}